<h1 id="header">GROUP A. VET DRUG</h1>
<?php
	$sql = 'SELECT
			  `bills`.`created_at`, `orders`.`price` AS oprice, `orders`.`unit`, `orders`.`num`,
			  `products`.`name` AS pname, `bills`.`bill_no`, `bills`.`store_name`, `members`.`name` AS mname,
			  `members`.`mobile`, `bills`.`reciever`, `bills`.`sender`, `bills`.`discount`,
			  `bills`.`region`, `bills`.`price` AS bprice, `bills`.`total`, `bills`.`transfer_price`,
			  `bills`.`annotation`, `bills`.`created_at`, `products`.`num` AS pnum,`bills`.`customer_address`,
			  `orders`.`order_id`, `orders`.`product_code`, `products`.`promotion`
			FROM
			  `bills` INNER JOIN
			  `orders` ON `orders`.`order_id` = `bills`.`order_id` INNER JOIN
			  `products` ON `orders`.`product_code` = `products`.`code` INNER JOIN
			  `members` ON `members`.`id` = `bills`.`members_id`
			WHERE
			  `bills`.`bill_no` = "'.$_GET['bid'].'"';
	$q = mysql_query($sql)or die(mysql_error());
	$rs= mysql_fetch_assoc($q);
	$rows = (16 - mysql_num_rows($q));
?>
<input type="hidden" name="bill_no" id="bill_no"  value="<?php echo $rs['bill_no'];?>" />
<input type="hidden" name="order_no" id="order_no" value="<?php echo $rs['order_id'];?>" />
<a href="?m=index" style="right:100px;position:fixed;" id="no_print">
	<img src="css/images/dashboard.png" width="110"  style="border:none;"/>
    <h1 style="text-align:center;">แผงควบคุม</h1>
</a>
<a href="#" onclick="window.print();return false;" style="margin-top:145px;right:100px;position:fixed;" id="no_print">
	<img src="css/images/Printer.png" width="110"  style="border:none;"/>
    <h1 style="text-align:center;">ปริ้นเดี๋ยวนี้</h1>
</a>

<table id="items" border="0">
  <thead style="text-align:left;">
  <tr>
    <th colspan="5" id="header">ใบส่งของ/ใบแจ้งหนี้</th>
  </tr>
  <tr>
  	<th colspan="3" class="customer" style="border:0 none;">ชื่อลูกค้า/ร้านค้า 
    <?php if($rs['store_name'] == ""){?>
    	<textarea class="customer" field="store_name" id="autocomplete" style="min-width:270px;">ป้อนชื่อลูกค้า</textarea>
   	<?php }else{ echo $rs['store_name'];}?>
   	</th>
    <th colspan="2">วันที่ <span class="date" field="created_at"><?php echo empty($rs['created_at'])? 'ป้อนวันที่': $rs['created_at'];?></span></th>
  </tr>
  <tr>
    <th colspan="3" style="border:0 none;">ที่อยู่ 
    <?php if($rs['customer_address'] == ""){ ?>
    	<textarea class="customer_address" field="customer_address" style="min-width:340px;">ป้อนที่อยู่ลูกค้า</textarea>
   	<?php }else{ echo $rs['customer_address'];}?>     
    </th>
  	<th colspan="2">เลขที่ <span class="bill_no"><?php echo $rs['bill_no'];?></span></th>
  </tr>
  <tr>
  	<th width="557">พนักงานขาย <?php echo $rs['mname']?> โทร <?php echo $rs['mobile'];?></th>
  	<th colspan="2"><span style="float:left;">เขต </span>
    <?php if($rs['region'] == ""){ ?>
    	<textarea class="region" field="region" style="width: 72px;"><?php echo empty($rs['region'])? 'ป้อนเขต' : $rs['region'];?></textarea>
   	<?php }else{ echo $rs['region'];}?>     
  	</th>
    <th colspan="2">เครดิต</th>
  </tr>
  <tr>
  	<th width="557" style="border-bottom-color:#000;"><div align="center"><strong>รายการสินค้า</strong></div></th>
  	<th width="90" style="border-bottom-color:#000;"><div align="center"><strong>จำนวน</strong></div></th>
  	<th width="60" style="border-bottom-color:#000;"><div align="center"><strong>หน่วย</strong></div></th>
    <th width="180" style="border-bottom-color:#000;"><div align="center"><strong>ขายต่อหน่วย</strong></div></th>
    <th width="90" style="border-bottom-color:#000;"><div align="center"><strong>จำนวนเงิน</strong></div></th>
  </tr>
  </thead>
  <?php 
  	@mysql_data_seek($q, 0);
  	while($b = mysql_fetch_assoc($q)){
	?>
  <tr class="item-row">
  	<td style="border:0 none;">
      <div class="delete-wpr">
		<?php echo $b['pname'];?>
        <a title="Remove row" href="javascript:;" class="delete" product-code="<?php echo $b['product_code'];?>">X</a>
      </div>
  	</td>
  	<td style="border:0 none;" align="center"><div field="num">
    	<textarea class="qt" 
        		  style="max-width: 50px;" 
                  field="num" 
                  data-table="order" data-table-code="<?php echo $b['product_code'];?>"
                  products-num="<?php echo $b['pnum'];?>"><?php echo empty($b['num'])? 0 : $b['num'];?></textarea></div>
   	</td>
  	<td style="border:0 none;"><?php echo $b['unit'];?></td>
  	<td style="border:0 none;"><div align="right" class="cost"><?php echo $b['oprice'];?></div></td>
    <td style="border-top:0 none;border-left:1px solid;" class="total-line">
    	<div align="right" class="price"><?php echo number_format($b['oprice']+$b['num'],2,'.',',');?></div>
   	</td>
  </tr>
  <?php }?>
  <tr id="hiderow">
    <td colspan="5"><a title="Add a row" href="javascript:;" id="addrow">เพิ่มสินค้า</a></td>
  </tr>
  <?php for($i=1;$i<$rows;$i++){?>
  <tr id="empty-row">
  	<td style="border:0 none;">&nbsp;</td>
  	<td style="border:0 none;"></td>
  	<td style="border:0 none;"></td>
  	<td style="border:0 none;"></td>
    <td style="border:0 none;border-left:1px solid;" class="total-line" align="right">-</td>
  </tr>
  <?php }?>
  <tr style=" border-top-color:#000;">
  	<td width="557" class="customer">
    	<div>หมายเหตุ <textarea class="annotation" field="annotation" style="width:100%;"></textarea></div>
        
   	</td>
  	<td colspan="3" >
    	<div>รวมเป็นเงิน</div>
      <div>หัก ส่วนลด <span style="color:red;font-size:smaller;" id="no_print">*</span> </div>
    <div align="right"></div>      <div align="right"></div></td>
    <td style=" border-top-color:#000;">
    	<div align="right" class="total" field="price">0.00</div>
    	<div align="right">
        	<textarea class="discount" field="discount" style="width:50px;"><?php echo empty($rs['discount'])? 0 : $rs['discount'];?></textarea>
       </div>          
    </td>
  </tr>
  <tr>
  	<td width="557" class="customer"><div align="center"><textarea style="width:100%;text-align:center;">(พิมพ์จำนวนเงินเป็นตัวอักษร)</textarea></div></td>
  	<td colspan="3"><div align="center">จำนวนเงินที่ต้องชำระ
    </div></td>
    <td><div align="right" class="real_price" field="total">0.00</div></td>
  </tr>
</table>
<p style="color:red;font-size:smaller;" id="no_print">* ถ้าใส่เปอร์เซ็นต์ (%) ลงไปจะนำไปคิดส่วนลดเป็นเปอร์เซ็นต์ ถ้าไม่ใส่จะคิดส่วนลดเป็นบาท</p>
<div id="terms">
  สินค้าตามรายการข้างต้น หากมีความเสียหายหรือขาดตกบกพร่องประการใดโปรดแจ้งบริษัทหรือตัวแทนขายภายใน <strong>7 วัน </strong>นับจากวันที่ได้รับสินค้า มิฉะนั้นจะถือว่าท่านได้รับสินค้าถูกต้องและบิลนี้สมบูรณ์  <strong>ท่านไม่แจ้งให้ทราบภายใจระยะเวลาที่กำหนด บริษัทจะไม่รับผิดชอบในความผิดพลาดที่เกิดขึ้น </strong> หากไม่ชำระเงินตามกำหนดเวลาที่ได้ตกลงไว้ บริษัทจะคิดดอกเบี้ยเพิ่มในอัตรา<strong> 20% ต่อปี </strong>จึงเรียนมาเพื่อทราบ
</div>
<table width="630" border="0">
<tr>
	<td style="border:0 none;">ลงชื่อผู้รับสินค้า
    	<textarea class="reciever" field="reciever" style="width:150px;height:17px;">....................................</textarea>
  	</td>
    <td align="right" style="border:0 none;">วันที่รับสินค้า
    	<textarea class="reciever_date" field="reciever_date" style="width:150px;height:17px;">....................................</textarea>
  	</td>
</tr>
<tr>
	<td style="border:0 none;">ลงชื่อผู้ส่งสินค้า
    	<textarea class="sender" field="sender" style="width:150px;height:17px;">....................................</textarea>
   	</td>
    <td align="right" style="border:0 none;">วันที่ส่งสินค้า
    	<textarea class="sender_date" field="sender_date" style="width:150px;height:17px;">....................................</textarea>
   	</td>
</tr>
</table>
<script type="text/javascript">
function print_today() {
  // ***********************************************
  // AUTHOR: WWW.CGISCRIPT.NET, LLC
  // URL: http://www.cgiscript.net
  // Use the script, just leave this message intact.
  // Download your FREE CGI/Perl Scripts today!
  // ( http://www.cgiscript.net/scripts.htm )
  // ***********************************************
  var now = new Date();
  var months = new Array('มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤษจิกายน','ธันวาคม');
  var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;
  }
  var today =   date+ " " + months[now.getMonth()] + " " + (fourdigits(now.getYear()+543));
  return today;
}

function initialPrice(){
	$('table tbody tr td').find('.qt').each(function(){
		var qt = parseFloat($(this).val());
		var ppu= parseFloat($(this).closest('tr').find('td .cost').html());
		$(this).closest('tr').find('td .price').html(addCommas(roundNumber(qt*ppu,2)))
	});
	sumPrice();
}
function update_price(){
	var pnum = parseInt($(this).attr('products-num'));
	var changeto = parseInt($(this).val());
	if(changeto > pnum){
		alert('รายการสินค้าคงเหลืออยู่ '+pnum+' คุณไม่สามารถกรอกเกินกว่าที่สินค้ามี');	
		$(this).val(0);
		sumPrice();		
	}else{
		var qt = parseFloat($(this).val());
		var ppu= parseFloat($(this).closest('tr').find('td .cost').html());
		$(this).closest('tr').find('td .price').html(addCommas(roundNumber(qt*ppu,2)))
		sumPrice();	
	}
	
}
function sumPrice(){
	var total = 0;
	$('.price').each(function(){
		
		if($(this).html() != "" && $(this).html() != "-"){
			total += parseFloat($(this).html().replace(',',''));
		}
	});
	total = isNaN(total)? 0 : total;
	$('.total').html(addCommas(roundNumber(total,2)));
	updateBill('price',total);
	realPrice();
}
function realPrice(){
	var is_percen =  $('.discount').text().search(/%/);
	var totalPrice = parseFloat($('.total').html().replace(',',''));
	var newPrice = 0;
	var disc = 0;
	if(is_percen == -1){		
		disc =  parseInt( $('.discount').text().replace('%',''));
		newPrice = totalPrice - disc;
	}else{
		disc =  parseInt( $('.discount').text().replace('%',''));
		if(disc > 0){
			newPrice = totalPrice - ((totalPrice * disc)/100);
		}else{
			newPrice = totalPrice - disc;
		}		
	}
	$('.discount').text($('.discount').text());
	$('.real_price').html(addCommas(roundNumber(newPrice,2)));
	updateBill('total',newPrice);
}
function updateDiscount(){
	var is_percen = $(this).val().search(/%/);
	var totalPrice = parseFloat($('.total').html().replace(',',''));
	var newPrice = 0;
	var disc = 0;
	if(is_percen == -1){		
		disc =  parseInt($(this).val().replace('%',''));
		newPrice = totalPrice - disc;
	}else{
		disc =  parseInt($(this).val().replace('%',''));
		if(disc > 0){
			newPrice = totalPrice - ((totalPrice * disc)/100);
		}else{
			newPrice = totalPrice - disc;
		}		
	}
	$('.discount').text($(this).val());	
	$('.real_price').html(addCommas(roundNumber(newPrice,2)));
	updateBill('total',newPrice);
}
function bind() {
  $(".qt").blur(update_price);
}
function updateBill(field,value){
	billNo = $('#bill_no').val();
	table = 'bills';
	$.ajax({
		type	: 'POST',
		url		: 'query.php',
		data	: {update_bill:true, bill_no:billNo, field:field, value:value},
		dataType: 'text',
		success : function(msg){
			//alert(msg);
		}
	});
}
function updateOrder(field,code,value){
	$.ajax({
		type	: 'POST',
		url		: 'query.php',
		data	: {update_order:true, order_no:$('#order_no').val(), field:field, value:value, code:code},
		dataType: 'text',
		success : function(msg){
			//alert(msg);
		}
	});
}

var _0xa939=["\x47\x52\x4F\x55\x50\x20\x41\x2E\x20\x56\x45\x54\x20\x44\x52\x55\x47","\x74\x65\x78\x74","\x64\x69\x73\x70\x6C\x61\x79","\x62\x6C\x6F\x63\x6B","\x63\x73\x73","\x23\x68\x65\x61\x64\x65\x72","\x72\x65\x6D\x6F\x76\x65","\x62\x6F\x64\x79","\x66\x69\x6E\x64","\x3C\x74\x72\x20\x63\x6C\x61\x73\x73\x3D\x22\x69\x74\x65\x6D\x2D\x72\x6F\x77\x22\x3E\x3C\x74\x64\x20\x73\x74\x79\x6C\x65\x3D\x22\x62\x6F\x72\x64\x65\x72\x3A\x30\x20\x6E\x6F\x6E\x65\x3B\x22\x3E\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x22\x64\x65\x6C\x65\x74\x65\x2D\x77\x70\x72\x22\x3E\x3C\x74\x65\x78\x74\x61\x72\x65\x61\x20\x69\x64\x3D\x22\x70\x72\x6F\x64\x75\x63\x74\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x6D\x69\x6E\x2D\x77\x69\x64\x74\x68\x3A\x32\x32\x35\x70\x78\x3B\x22\x3E\u0E0A\u0E37\u0E48\u0E2D\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\x3C\x2F\x74\x65\x78\x74\x61\x72\x65\x61\x3E\x3C\x61\x20\x74\x69\x74\x6C\x65\x3D\x22\x52\x65\x6D\x6F\x76\x65\x20\x72\x6F\x77\x22\x20\x68\x72\x65\x66\x3D\x22\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x3B\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x64\x65\x6C\x65\x74\x65\x22\x20\x70\x72\x6F\x64\x75\x63\x74\x2D\x63\x6F\x64\x65\x3D\x22\x22\x3E\x58\x3C\x2F\x61\x3E\x3C\x2F\x64\x69\x76\x3E\x3C\x2F\x74\x64\x3E\x3C\x74\x64\x20\x73\x74\x79\x6C\x65\x3D\x22\x62\x6F\x72\x64\x65\x72\x3A\x30\x20\x6E\x6F\x6E\x65\x3B\x22\x20\x61\x6C\x69\x67\x6E\x3D\x22\x63\x65\x6E\x74\x65\x72\x22\x3E\x3C\x74\x65\x78\x74\x61\x72\x65\x61\x20\x63\x6C\x61\x73\x73\x3D\x22\x71\x74\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x6D\x61\x78\x2D\x77\x69\x64\x74\x68\x3A\x20\x35\x30\x70\x78\x3B\x22\x20\x66\x69\x65\x6C\x64\x3D\x22\x6E\x75\x6D\x22\x20\x64\x61\x74\x61\x2D\x74\x61\x62\x6C\x65\x3D\x22\x6F\x72\x64\x65\x72\x22\x20\x64\x61\x74\x61\x2D\x74\x61\x62\x6C\x65\x2D\x63\x6F\x64\x65\x3D\x22\x22\x20\x70\x72\x6F\x64\x75\x63\x74\x73\x2D\x6E\x75\x6D\x3D\x22\x22\x3E\x30\x3C\x2F\x74\x65\x78\x74\x61\x72\x65\x61\x3E\x3C\x2F\x74\x64\x3E\x3C\x74\x64\x20\x73\x74\x79\x6C\x65\x3D\x22\x62\x6F\x72\x64\x65\x72\x3A\x30\x20\x6E\x6F\x6E\x65\x3B\x22\x3E\x3C\x2F\x74\x64\x3E\x3C\x74\x64\x20\x73\x74\x79\x6C\x65\x3D\x22\x62\x6F\x72\x64\x65\x72\x3A\x30\x20\x6E\x6F\x6E\x65\x3B\x22\x3E\x3C\x64\x69\x76\x20\x61\x6C\x69\x67\x6E\x3D\x22\x72\x69\x67\x68\x74\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x63\x6F\x73\x74\x22\x3E\x3C\x2F\x64\x69\x76\x3E\x3C\x2F\x74\x64\x3E\x3C\x74\x64\x20\x73\x74\x79\x6C\x65\x3D\x22\x62\x6F\x72\x64\x65\x72\x2D\x74\x6F\x70\x3A\x30\x20\x6E\x6F\x6E\x65\x3B\x62\x6F\x72\x64\x65\x72\x2D\x6C\x65\x66\x74\x3A\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x3B\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x74\x6F\x74\x61\x6C\x2D\x6C\x69\x6E\x65\x22\x3E\x3C\x64\x69\x76\x20\x61\x6C\x69\x67\x6E\x3D\x22\x72\x69\x67\x68\x74\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x70\x72\x69\x63\x65\x22\x3E\x30\x2E\x30\x30\x3C\x2F\x64\x69\x76\x3E\x3C\x2F\x74\x64\x3E\x3C\x2F\x74\x72\x3E","\x61\x66\x74\x65\x72","\x2E\x69\x74\x65\x6D\x2D\x72\x6F\x77\x3A\x6C\x61\x73\x74","\x6C\x65\x6E\x67\x74\x68","\x2E\x64\x65\x6C\x65\x74\x65","\x73\x68\x6F\x77","\x23\x65\x6D\x70\x74\x79\x2D\x72\x6F\x77","\x6E\x65\x78\x74","\x74\x72","\x63\x6C\x6F\x73\x65\x73\x74","\x6B\x65\x79\x64\x6F\x77\x6E\x2E\x61\x75\x74\x6F\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x73\x65\x61\x72\x63\x68\x2E\x70\x68\x70\x3F\x74\x61\x62\x6C\x65\x3D\x70\x72\x6F\x64\x75\x63\x74\x73","","\x6C\x61\x62\x65\x6C","\x69\x74\x65\x6D","\x50\x4F\x53\x54","\x71\x75\x65\x72\x79\x2E\x70\x68\x70","\x76\x61\x6C","\x23\x62\x69\x6C\x6C\x5F\x6E\x6F","\x23\x6F\x72\x64\x65\x72\x5F\x6E\x6F","\x6A\x73\x6F\x6E","\x72\x65\x6C\x6F\x61\x64","\x61\x6A\x61\x78","\x61\x75\x74\x6F\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x62\x69\x6E\x64","\x23\x70\x72\x6F\x64\x75\x63\x74","\x63\x6C\x69\x63\x6B","\x23\x61\x64\x64\x72\x6F\x77","\u0E04\u0E38\u0E13\u0E41\u0E19\u0E48\u0E43\u0E08\u0E2B\u0E23\u0E37\u0E2D\u0E40\u0E1B\u0E25\u0E48\u0E32\u0E27\u0E48\u0E32\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E32\u0E23\u0E25\u0E1A\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E19\u0E35\u0E49\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23","\x70\x72\x6F\x64\x75\x63\x74\x2D\x63\x6F\x64\x65","\x61\x74\x74\x72","\x2E\x69\x74\x65\x6D\x2D\x72\x6F\x77","\x70\x61\x72\x65\x6E\x74\x73","\x68\x69\x64\x65","\x6C\x69\x76\x65","\x68\x74\x6D\x6C","\x66\x69\x65\x6C\x64","\x2E\x64\x61\x74\x65","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x64\x69\x73\x63\x6F\x75\x6E\x74","\x64\x61\x74\x61\x2D\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x2D\x74\x61\x62\x6C\x65\x2D\x63\x6F\x64\x65","\x62\x6C\x75\x72","\x74\x65\x78\x74\x61\x72\x65\x61","\x73\x75\x63\x63\x65\x73\x73","\x23\x6E\x6F\x5F\x70\x72\x69\x6E\x74","\x73\x65\x61\x72\x63\x68\x2E\x70\x68\x70\x3F\x74\x61\x62\x6C\x65\x3D\x63\x75\x73\x74\x6F\x6D\x65\x72\x73","\x74\x72\x69\x6D","\x74\x65\x78\x74\x61\x72\x65\x61\x2E\x63\x75\x73\x74\x6F\x6D\x65\x72\x5F\x61\x64\x64\x72\x65\x73\x73","\x2E\x63\x75\x73\x74\x6F\x6D\x65\x72"];var store=_0xa939[0];function checkStore(){$(_0xa939[5])[_0xa939[4]](_0xa939[2],_0xa939[3])[_0xa939[1]]();if(store!=$(_0xa939[5])[_0xa939[1]]()){$(document)[_0xa939[8]](_0xa939[7])[_0xa939[6]]();} ;} ;$(function (){checkStore();initialPrice();$(_0xa939[36])[_0xa939[35]](function (){$(_0xa939[11])[_0xa939[10]](_0xa939[9]);if($(_0xa939[13])[_0xa939[12]]>0){$(_0xa939[13])[_0xa939[14]]();} ;$(this)[_0xa939[18]](_0xa939[17])[_0xa939[16]](_0xa939[15])[_0xa939[6]]();$(_0xa939[34])[_0xa939[33]](_0xa939[19],function (){$(this)[_0xa939[32]]({source:_0xa939[20],select:function (_0x7db9x3,_0x7db9x4){var _0x7db9x5=_0xa939[21];var _0x7db9x6=$(this);if(_0x7db9x4[_0xa939[23]][_0xa939[22]]!=_0xa939[21]){$[_0xa939[31]]({type:_0xa939[24],url:_0xa939[25],data:{search_products:true,data:_0x7db9x4[_0xa939[23]][_0xa939[22]],bill:$(_0xa939[27])[_0xa939[26]](),order_id:$(_0xa939[28])[_0xa939[26]]()},dataType:_0xa939[29],success:function (_0x7db9x7){location[_0xa939[30]]();} });} ;} });} );} );$(_0xa939[13])[_0xa939[43]](_0xa939[35],function (){if(confirm(_0xa939[37])){_this=$(this);$[_0xa939[31]]({type:_0xa939[24],url:_0xa939[25],data:{delete_products:true,pid:_this[_0xa939[39]](_0xa939[38])},dataType:_0xa939[1],success:function (_0x7db9x7){_this[_0xa939[41]](_0xa939[40])[_0xa939[6]]();_this[_0xa939[39]](_0xa939[38]);sumPrice();if($(_0xa939[13])[_0xa939[12]]<2){$(_0xa939[13])[_0xa939[42]]();} ;} });} ;} );bind();$(_0xa939[46])[_0xa939[35]](function (){$(this)[_0xa939[44]](print_today());field=$(this)[_0xa939[39]](_0xa939[45]);value=print_today();updateBill(field,value);} );$(_0xa939[52])[_0xa939[51]](function (){field=$(this)[_0xa939[39]](_0xa939[45]);value=$(this)[_0xa939[26]]();if( typeof field!=_0xa939[47]&&field!=_0xa939[47]){if(field==_0xa939[48]){updateDiscount();} ;if($(this)[_0xa939[39]](_0xa939[49])!=_0xa939[47]){updateOrder($(this)[_0xa939[39]](_0xa939[45]),$(this)[_0xa939[39]](_0xa939[50]),$(this)[_0xa939[26]]());} ;updateBill(field,value);} ;} );$(_0xa939[54])[_0xa939[35]](function (){$[_0xa939[31]]({type:_0xa939[24],url:_0xa939[25],data:{update_item:true,bill_no:$(_0xa939[27])[_0xa939[26]]()},dataType:_0xa939[44],success:function (_0x7db9x7){if(_0x7db9x7==_0xa939[53]){return true;} else {return false;} ;} });} );$(_0xa939[58])[_0xa939[33]](_0xa939[19],function (){$(this)[_0xa939[32]]({source:_0xa939[55],select:function (_0x7db9x3,_0x7db9x4){var _0x7db9x5=_0xa939[21];if(_0x7db9x4[_0xa939[23]][_0xa939[22]]!=_0xa939[21]){$[_0xa939[31]]({type:_0xa939[24],url:_0xa939[25],data:{searcher:true,data:_0x7db9x4[_0xa939[23]][_0xa939[22]],bill:$(_0xa939[27])[_0xa939[26]]()},dataType:_0xa939[1],success:function (_0x7db9x7){_0x7db9x5=$[_0xa939[56]](_0x7db9x7);$(_0xa939[57])[_0xa939[1]](_0x7db9x5);$(_0xa939[57])[_0xa939[26]](_0x7db9x5);} });} ;} });} );} ); 
</script>
<style type="text/css">
ul.ui-autocomplete {
	height: 300px;
	overflow: auto;
}
</style>